﻿let dexFilepath = "./luaj-jse-3.0.1.jar";
runtime.loadJar(dexFilepath);

importClass("org.luaj.vm2.lib.jse.JsePlatform");

//创建Globals对象来管理全局状态
globals = JsePlatform.standardGlobals();
var luaPath = files.path("./luaTest.lua");
globals.loadfile(luaPath).call();
c = globals.get("c").toString(); //取得脚本里的变量d的值
log("c: " + c);

// s = ""; //lua脚本
// s += "x=3\r\n";
// s += "y=4\r\n";
// s += "print ('hello world!')\r\n";
// s += "function aa()\r\n";
// s += "print ('aaa')\r\n";
// s += "end\r\n";
// s += "aa()\r\n";
// s += "function method1()\r\n";
// s += "return x * 2\r\n";
// s += "end\r\n";
// s += "c=method1(x)\r\n";

// chunk = globals.load(s); //加载自己写的脚本
// chunk.call(); //执行脚本
// c = globals.get("c").toString(); //取得脚本里的变量d的值
// log("c: " + c);
